﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ERPStudio;
using System.Data.SqlClient;

namespace AMix
{
    public partial class MijlocFixRezumatFrm : FrmRezumat
    {

        private BindingSource amixRegistruBS = null;
        private Int32 IDMijlocFixSel = -1;
        private Boolean MijlocFix = true;
        public MijlocFixRezumatFrm(ModuleClass mc, BindingSource arbs,Int32 selid,Boolean mf): base(mc)
        {
            InitializeComponent();
            amixRegistruBS = arbs;
            IDMijlocFixSel = selid;
            //ReadOnly = true;
            MijlocFix = mf;
        }

        private void MijlocFixRezumatFrm_Load(object sender, EventArgs e)
        {
            SqlConnection con = DeschideConexiune(workConnString);
            this.surseFinantareTableAdapter.Connection = con;
            this.surseFinantareTableAdapter.Fill(this.eSRPDataSet.SurseFinantare);

            departamenteTableAdapter.Connection = con;
            departamenteTableAdapter.Fill(eSRPDataSet.Departamente, ModuleInfo.CodUnitate);
            /*this.amixTipStareTableAdapter.Connection = con;
            this.amixTipStareTableAdapter.Fill(this.eSRPDataSet.AmixTipStare);
            */
            this.amixGestionariTableAdapter.Connection = con;
            this.amixGestionariTableAdapter.Fill(this.eSRPDataSet.AmixGestionari);

            this.amixCatalogTableAdapter.Connection = con;
            this.amixCatalogTableAdapter.Fill(this.eSRPDataSet.AmixCatalog);
            this.amixTipStareTableAdapter.Connection = con;
            this.amixTipStareTableAdapter.Fill(this.eSRPDataSet.AmixTipStare);

            this.amixRegistruTableAdapter.Connection = con;
            this.amixRegistruTableAdapter.Fill(this.eSRPDataSet.AmixRegistru, ModuleInfo.CodUnitate,(short)(MijlocFix?0:3),(short)(MijlocFix?2:5));


            InchideConexiune(con);

            this.listBndSourceMain.Add(amixRegistruBindingSource);
            listTableAdaptor.Add(amixRegistruTableAdapter.Adapter);
            HandleSalvare += new EventHandler(Salvare);

        }

        
    }
}
